package cn.v2tila.rsosa.student.service.serviceImpl;

import cn.v2tila.rsosa.student.entity.ContactsEntity;
import cn.v2tila.rsosa.student.jpa.ContactsJPA;
import cn.v2tila.rsosa.student.service.ContactsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author v2tila on 0:26 2019/4/7
 */
@Service
public class ContactsServiceImpl implements ContactsService {
    @Autowired
    private ContactsJPA contactsJPA;
    @Override
    public ContactsEntity saveAndFlush(ContactsEntity contactsEntity) {
        return contactsJPA.saveAndFlush(contactsEntity);
    }

    @Override
    public boolean existsByUniqueIdAndContactUniqueId(String uniqueId, String contactUniqueId) {
        return contactsJPA.existsByUniqueIdAndContactUniqueId(uniqueId, contactUniqueId);
    }

    @Override
    public List<ContactsEntity> findByUniqueId(String uniqueId) {
        return contactsJPA.findByUniqueId(uniqueId);
    }

    @Override
    public ContactsEntity findByUniqueIdAndContactUniqueId(String uniqueId, String contactUniqueId) {
        return contactsJPA.findByUniqueIdAndContactUniqueId(uniqueId, contactUniqueId);
    }

}
